#!/bin/env pypy

import sys
import random

DICT_PATH = '/usr/share/dict/linux.words'
LINES = 1000000

if __name__ == '__main__':
    random.seed(0)

    df = open(DICT_PATH, 'r')
    words = df.readlines()
    words = filter(lambda s: len(s) <= 11 and all(c.islower() for c in s), map(lambda s: s.strip(), words))
    df.close()

    lines = int(sys.argv[1]) if len(sys.argv) > 1 else LINES

    if lines < 1000000:
        random.shuffle(words)
        words = words[0: len(words) / 10]

    for i in range(lines):
        num = random.randint(1, 5)
        print ' '.join([words[random.randint(0, len(words) - 1)] for j in range(num)])
